package net.mingsoft.mdiy.entity;

import net.mingsoft.base.entity.*;
import com.baomidou.mybatisplus.annotation.*;
import org.apache.commons.lang3.*;
import net.mingsoft.basic.util.*;
import cn.hutool.crypto.*;
import cn.hutool.json.*;
import cn.hutool.core.util.*;
import java.util.*;

@TableName("mdiy_model")
public class ModelEntity extends BaseEntity
{
    private static final long serialVersionUID = 1573286039152L;
    @TableId(type = IdType.ASSIGN_ID)
    private String id;
    @TableField(whereStrategy = FieldStrategy.NOT_EMPTY)
    private String modelName;
    private String modelTableName;
    @TableField(whereStrategy = FieldStrategy.NEVER)
    private int notDel;
    @TableField(whereStrategy = FieldStrategy.NEVER)
    private int modelIdType;
    private String modelType;
    private String modelCustomType;
    private String modelJson;
    private String modelField;
    @TableField(exist = false)
    private String formUrl;
    
    public String getFormUrl() {
        if (StringUtils.isNotBlank((CharSequence)this.id)) {
            this.formUrl = SecureUtil.aes(SecureUtil.md5(BasicUtil.getApp().getAppId() + "").substring(16).getBytes()).encryptHex(this.id);
        }
        return this.formUrl;
    }
    
    public void setFormUrl(final String formUrl) {
        this.formUrl = formUrl;
    }
    
    public void setModelName(final String modelName) {
        this.modelName = modelName;
    }
    
    public String getModelName() {
        return this.modelName;
    }
    
    public void setModelTableName(final String modelTableName) {
        this.modelTableName = modelTableName;
    }
    
    public String getModelTableName() {
        return this.modelTableName;
    }
    
    public void setModelType(final String modelType) {
        this.modelType = modelType;
    }
    
    public String getModelType() {
        return this.modelType;
    }
    
    public void setModelCustomType(final String modelCustomType) {
        this.modelCustomType = modelCustomType;
    }
    
    public String getModelCustomType() {
        return this.modelCustomType;
    }
    
    public void setModelJson(final String modelJson) {
        this.modelJson = modelJson;
    }
    
    public String getModelJson() {
        return this.modelJson;
    }
    
    public void setModelField(final String modelField) {
        this.modelField = modelField;
    }
    
    public String getModelField() {
        return this.modelField;
    }
    
    public Map getFieldMap() {
        final Map map = new HashMap();
        final List<Map> list = (List<Map>)JSONUtil.toList(this.modelField, (Class)Map.class);
        if (ObjectUtil.isNotNull((Object)list)) {
            for (final Map field : list) {
                map.put(field.get("model"), field.get("key"));
            }
        }
        return map;
    }
    
    public int getNotDel() {
        return this.notDel;
    }
    
    public void setNotDel(final int notDel) {
        this.notDel = notDel;
    }
    
    public String getId() {
        return this.id;
    }
    
    public void setId(final String id) {
        this.id = id;
    }
    
    public int getModelIdType() {
        return this.modelIdType;
    }
    
    public void setModelIdType(final int modelIdType) {
        this.modelIdType = modelIdType;
    }
}
